<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button>发送验证码</button>

    <script>
      document.querySelector('button').addEventListener('click', function () {
        this.disabled = true

        //设置一个定时器
        // setTimeout(
        //   function () {
        //     this.disabled = false
        //   }.bind(this),
        //   3000
        // )

        setTimeout(() => {
          this.disabled = false
        }, 3000)
      })
    </script>
  </body>
</html>
